#!/bin/awk -f
## select tiling(s) number from tilings.out
## Synopsis: cat TILING | poptil N [-nohead]
BEGIN{
  sel=ARGV[1];
  if(ARGV[2]=="-nohead"){
    nohead=1; ARGV[2]="";
  }
  ARGV[1]="-";
  ARGC=2;
}
FNR==1{
  nn=$1; mu=$2; nt=$3;
}
FNR>1&&FNR<4&&nohead==""{print} #basis
FNR==3{
  if(nohead=="")print nn,mu;
  for(i=1;i<sel;i++){
    if(sel>nt){exit}
    for(j=1;j<=nn;j++){getline};
  }
  for(j=1;j<=nn;j++){
    getline; print $0;
  }
}
END{}
